package com.jeff.android.lab;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;

import butterknife.ButterKnife;

/**
 * @author: duff
 * @date: 2019/1/10
 * @since: 1.0.0
 */
public abstract class BaseFragment extends Fragment {

    protected final static String TAG = "dingfeng";

    protected Context mContext;

    protected abstract int getRootLayout();

    protected void initView() {
    }

    protected void initData() {
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getRootLayout(), container, false);
        ButterKnife.bind(this, view);
        initView();
        return view;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initData();
    }

}
